package com.three.Service.ServiceImpl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.three.Mapper.TeacherMapper;
import com.three.Pojo.Teacher;
import com.three.Service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements ITeacherService {
    @Autowired
    private TeacherMapper teacherMapper;

    @Override
    public void addsave(Teacher teacher) {
        teacherMapper.addsave(teacher);
    }

    @Override
    public PageInfo<Teacher> findlist(Integer pageNum, Integer pageSize, String teacherName) {
        PageHelper.startPage(pageNum,pageSize);
        List<Teacher> teacherList=teacherMapper.findteacherlist(teacherName);
        PageInfo<Teacher> pageInfo=new PageInfo<>(teacherList);
        return pageInfo;
    }

    @Override
    public Teacher findByid(Integer id) {
        return teacherMapper.findByid(id);
    }

    @Override
    public void updatesave(Teacher teacher) {
        teacherMapper.updatesave(teacher);
    }

    @Override
    public void delete(Integer id) {
        teacherMapper.delete(id);
    }
}
